home *** CD-ROM | disk | FTP | other *** search
/ Freelog 121 / FreelogMagazineJuilletAout2014-No121.iso / Outils / Adobe-Air / adobe-air_13.exe / [0] / setup.swf / scripts / mx / utils / XMLNotifier.as < prev   
Text File  |  2014-03-27  |  3KB  |  98 lines

  1. package mx.utils
  2. {
  3.    import flash.utils.Dictionary;
  4.    import mx.core.mx_internal;
  5.    
  6.    use namespace mx_internal;
  7.    
  8.    public class XMLNotifier
  9.    {
  10.       
  11.       private static var instance:XMLNotifier;
  12.       
  13.       mx_internal static const VERSION:String = "3.0.0.0";
  14.        
  15.       
  16.       public function XMLNotifier(param1:XMLNotifierSingleton)
  17.       {
  18.          super();
  19.       }
  20.       
  21.       public static function getInstance() : XMLNotifier
  22.       {
  23.          if(!instance)
  24.          {
  25.             instance = new XMLNotifier(new XMLNotifierSingleton());
  26.          }
  27.          return instance;
  28.       }
  29.       
  30.       mx_internal static function initializeXMLForNotification() : Function
  31.       {
  32.          var notificationFunction:Function = function(param1:Object, param2:String, param3:Object, param4:Object, param5:Object):void
  33.          {
  34.             var _loc8_:* = null;
  35.             var _loc7_:Dictionary;
  36.             if((_loc7_ = arguments.callee.watched) != null)
  37.             {
  38.                for(_loc8_ in _loc7_)
  39.                {
  40.                   IXMLNotifiable(_loc8_).xmlNotification(param1,param2,param3,param4,param5);
  41.                }
  42.             }
  43.          };
  44.          return notificationFunction;
  45.       }
  46.       
  47.       public function watchXML(param1:Object, param2:IXMLNotifiable, param3:String = null) : void
  48.       {
  49.          var _loc6_:Dictionary = null;
  50.          var _loc5_:Object;
  51.          var _loc4_:XML;
  52.          if(!((_loc5_ = (_loc4_ = XML(param1)).notification()) is Function))
  53.          {
  54.             _loc5_ = initializeXMLForNotification();
  55.             _loc4_.setNotification(_loc5_ as Function);
  56.             if(param3 && _loc5_["uid"] == null)
  57.             {
  58.                _loc5_["uid"] = param3;
  59.             }
  60.          }
  61.          if(_loc5_["watched"] == undefined)
  62.          {
  63.             _loc5_["watched"] = _loc6_ = new Dictionary(true);
  64.          }
  65.          else
  66.          {
  67.             _loc6_ = _loc5_["watched"];
  68.          }
  69.          _loc6_[param2] = true;
  70.       }
  71.       
  72.       public function unwatchXML(param1:Object, param2:IXMLNotifiable) : void
  73.       {
  74.          var _loc5_:Dictionary = null;
  75.          var _loc3_:XML = XML(param1);
  76.          var _loc4_:Object;
  77.          if(!((_loc4_ = _loc3_.notification()) is Function))
  78.          {
  79.             return;
  80.          }
  81.          if(_loc4_["watched"] != undefined)
  82.          {
  83.             delete (_loc5_ = _loc4_["watched"])[param2];
  84.          }
  85.       }
  86.    }
  87. }
  88.  
  89. class XMLNotifierSingleton
  90. {
  91.     
  92.    
  93.    function XMLNotifierSingleton()
  94.    {
  95.       super();
  96.    }
  97. }
  98.